import {Vue, Component } from 'vue-property-decorator';
@Component
export default class CommonMixins extends Vue{
    [x: string]: any;
    msg(msg: string){
        this.$message({
            message: msg,
            type: 'info',
            center: true,
        });
    }
    msgSuccess(msg: string){
        this.$message({
            message: msg,
            type: 'success',
            center: true,
        });
    }
    msgWarning(msg: string){
        this.$message({
            message: msg,
            type: 'warning',
            center: true,
        });
    }
    msgError(msg: string){
        this.$message({
            message: msg,
            type: 'error',
            center: true,
        });
    }
    iKnow(msg: string){
        this.$alert(msg, '温馨提示', {
            confirmButtonText: '我知道了',
        });
    }
    confirm(title: string, confirmTxt: string, okFun: Function, cancelFun: Function){
        this.$confirm(confirmTxt, '提示', {
            title: title,
            message: confirmTxt,
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
            callback: (action, instance) => {
                if (action === 'confirm') {
                    okFun();
                }
                if (action === 'cancel') {
                    cancelFun();
                }
            }
          });
    }
    
}